# 线程间通信，线程安全
import requests
import time
from threading import Thread

zero=0
def foo():
    global zero
    for i in range(10**4):
        zero+=1
        zero-=1

if __name__=="__main__":
    thread_arr=[]
    for i in  range(2):
        t=Thread(target=foo)
        thread_arr.append(t)
        t.start()
    for t in thread_arr:
        t.join()#将线程中的内容进行完，再开始下面的代码
    print(zero)


# 0
# 2
# 1
# 3
# 6
# 5
# 4
# 9
# 8
# 7